Skip to content

SVE 256-bit Implementation of mxfp4 gemv kernel - #28141

Open
abhijain1204fujitsu wants to merge 3 commits into
ggml-org:masterfrom
MonakaResearch:sve_256_mxfp4_gemv
Open

SVE 256-bit Implementation of mxfp4 gemv kernel#28141
abhijain1204fujitsu wants to merge 3 commits into
ggml-org:masterfrom
MonakaResearch:sve_256_mxfp4_gemv

Conversation

@abhijain1204fujitsu

@abhijain1204fujitsu abhijain1204fujitsu commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR aims to add SVE 256 support for the ggml_gemv_mxfp4_4x4_q8_0 kernel found in profiling of gpt-oss-20b MoE model.

Additional information

GPT-OSS-20B SVE256 Performance

(Taken on Graviton3e)

Task Threads NEON SVE 256 Improvement (%)
PP128 4 25.71 29.30 13.96
TG128 4 20.84 23.39 12.24
PP128 8 51.09 58.19 13.90
TG128 8 37.94 42.01 10.73
PP128 16 100.40 113.92 13.47
TG128 16 61.35 65.86 7.35
PP128 32 188.67 213.06 12.93
TG128 32 73.99 76.31 3.14

Perplexity:

Metric NEON SVE
Final Estimate PPL 297.7341 ± 18.27793 297.7341 ± 18.27793

Requirements

Co Authors: @anubhavfujitsu

@github-actions github-actions Bot added the ggml changes relating to the ggml tensor library for machine learning label Sep 1, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

Hi @abhijain1204fujitsu, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • Maintainers cannot push to this PR: Please enable Allow edits by maintainers. If this PR comes from an organization-owned fork, that option is not available on GitHub; please re-open the PR from a fork owned by your personal account.

Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@ggml-gh-bot ggml-gh-bot Bot added the draft PR will be changed to draft by github-actions bot label Sep 1, 2026
@github-actions
github-actions Bot marked this pull request as draft September 1, 2026 07:54
@github-actions github-actions Bot removed the draft PR will be changed to draft by github-actions bot label Sep 1, 2026
@abhijain1204fujitsu
abhijain1204fujitsu marked this pull request as ready for review September 1, 2026 08:01
@abhijain1204fujitsu

Copy link
Copy Markdown
Contributor Author

@ggerganov, @Alcpz
Kindly support to review the PR

@Alcpz Alcpz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've replicated the performance on a different machine, e2e instead of Neon vs SVE:

Model Test Threads master SVE (t/s) PR SVE (t/s) Diff (%)
gpt-oss-20b PP128 4 31.62 35.44 12.1
gpt-oss-20b TG128 4 22.78 24.90 9.3
gpt-oss-20b PP128 8 56.55 60.97 7.8
gpt-oss-20b TG128 8 37.64 38.91 3.4
gpt-oss-20b PP128 16 104.69 110.26 5.3
gpt-oss-20b TG128 16 54.65 56.41 3.2
Qwen3.6-35B-A3B PP128 4 41.38 42.80 3.4
Qwen3.6-35B-A3B TG128 4 18.40 19.06 3.6
Qwen3.6-35B-A3B PP128 8 72.33 73.94 2.2
Qwen3.6-35B-A3B TG128 8 28.23 28.99 2.7
Qwen3.6-35B-A3B PP128 16 125.20 127.04 1.5
Qwen3.6-35B-A3B TG128 16 35.65 36.19 1.5
LFM2.5-8B-A1B PP128 4 81.10 90.30 11.3
LFM2.5-8B-A1B TG128 4 47.67 50.53 6.0
LFM2.5-8B-A1B PP128 8 143.14 153.41 7.2
LFM2.5-8B-A1B TG128 8 76.29 78.79 3.3
LFM2.5-8B-A1B PP128 16 259.69 271.01 4.4
LFM2.5-8B-A1B TG128 16 107.43 107.53 0.1

I observed worse performance E2E for Qwen, but that's because the NEON path is faster, not due to this PR.

Built and measured with:

cmake -DCMAKE_BUILD_TYPE=Release \
  -DGGML_NATIVE=OFF \
  -DGGML_CPU_ARM_ARCH=armv8.6-a+sve

build/bin/llama-bench -p 128 -n 128 -t 4,8,16

Perplexity also checks out (added master as I saw differences in Perplexity, but those seem to come from other SVE kernels):

Model NEON SVE (PR) SVE (master)
gpt-oss-20b MXFP4 237.1192 ± 8.81243 238.5075 ± 8.86238 238.5075 ± 8.86238
Qwen3.6-35B-A3B MXFP4_MOE 5.5133 ± 0.14971 5.5160 ± 0.14968 5.5160 ± 0.14968
LFM2.5-8B-A1B MXFP4_MOE 27.2469 ± 1.11531 27.1599 ± 1.11147 27.1599 ± 1.11147
# Run as
llama-perplexity -f wikitext-2-raw/wiki.test.raw --chunks 30 -t 16

UNUSED(blocklen);

#if defined(__aarch64__) && defined(__ARM_FEATURE_SVE)
if (svcntb() == 32) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: I've seen this if in other SVE kernels as svcntb() * 8 == 256. If those are yours, I'd push to have a consistent conditional logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants